package router

import (
	"github.com/gin-gonic/gin"
	add3 "shop/internal/controller/address"
	coupon3 "shop/internal/controller/coupon"
	goods3 "shop/internal/controller/goods"
	order3 "shop/internal/controller/order"
	user3 "shop/internal/controller/user"
	"shop/pkg"
)

func Route(r *gin.Engine) {
	user := r.Group("/user")
	user.Use(pkg.TokenMiddle())
	{
		user.POST("/message/upd", user3.UserMessageUpd)
		user.POST("/login/out", user3.UserLoginOut)
		user.POST("/info/userId", user3.UserInfo)
	}
	users := r.Group("/users")
	{
		users.POST("/login", user3.UserLogin)
		users.POST("/register", user3.UserRegister)
		users.POST("/send/code", user3.SendCode)
		users.POST("/phone/upd", user3.UpdatePhone)
		users.POST("/password/upd", user3.UpdatePassword)
	}
	coupon := r.Group("/coupon")
	{
		coupon.POST("/user/center/coupon/list", coupon3.UserCenterCouponList)
		coupon.POST("/goods/order/coupon/list", coupon3.GoodsOrderCouponList)
		coupon.POST("/member/list", coupon3.MemberList)
		coupon.POST("/points/list", coupon3.PointsList)
		coupon.POST("/points/info", coupon3.PointsInfo)
		coupon.POST("/add/points/deduction", coupon3.CouponPointsAdd)
		coupon.POST("/multiple/add/user/vip", coupon3.CouponVipMultipleAdd)
	}
	goods := r.Group("/goods")
	{
		goods.POST("/list", goods3.GoodsList)
		goods.POST("/info", goods3.GoodsSearchTypeByGoodsTitle)
	}
	types := r.Group("/type")
	{
		types.POST("/list", goods3.GetGoodsIDs)
		types.POST("/list/lv", goods3.GetTypesInfo)
	}
	add := r.Group("/address")
	add.Use(pkg.TokenMiddle())
	{
		add.POST("/add", add3.AddressCreate)
		add.POST("/list", add3.AddressList)
	}
	file := r.Group("/file")
	{
		file.POST("/img", user3.UploadOss)
	}
	order := r.Group("/order")
	{
		order.POST("/create", order3.OrderCreation)
		order.POST("/upd/status", order3.UpdateByState)
	}
}
